

<?php
//authentication technopreneurship; kelas yang akan melakukan proses Login dan Logout pada technopreneurship
class auth {

	function auth () {	
		session_start();
	}
	
	// by Suvi
	function login ($user, $pwd ){
		
		$checkDB = mysql_query("SELECT * FROM account_technopreneur where USERNAME = '".$user."' AND PASSWORD = md5('".$pwd."')");
		$jumlahData = mysql_num_rows($checkDB);
		//echo $jumlahData;
		if($jumlahData > 0)
		{
			while($row = mysql_fetch_array($checkDB)){
			$_SESSION['ID_TECHNOPRENEUR']= $row['ID_TECHNOPRENEUR'];
			$_SESSION['USERNAME']=$row['USERNAME'];
			$_SESSION['time']=time();
			}
			return TRUE;
				
		}
		 else {
			
			return FALSE;
				 
		}

	}

	// by Anin
	function logout () {
	
		session_unset () ;
		session_destroy () ;
		
	} 

}
?>